import java.util.Scanner;
class Account{
	private int balance;
   public Account(int balance) {
		super();
		this.balance = balance;
	}
	public int getBalance() {
		return balance;
	}

	public void setBalance(int balance) {
		this.balance = balance;
	}
	public synchronized void  deposit(int money){
		balance=balance+money;
		notify();
	}
	public synchronized void  withdraw(int money){
		
		while (balance < money) {
			try {
				wait();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		balance=balance-money;
		 if(balance<0){
			           throw new IllegalStateException(balance+"");
			   }
		
	}
	
}